package com.bamanker.cloudconsumer.feign;


import com.bamanker.cloudapi.model.error.CommonErrorCode;
import com.bamanker.cloudapi.model.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;

/**
 * 调用失败的后的处理方法
 *
 * @author bamanker
 */
//@Component
@Slf4j
public class ResFeignClientFallback implements ResClient {

    @Override
    public Object getRes1() {
        log.error("调用接口 /resource1 失败，参数：");
        //return "OpenFeign 降级";
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getRes2() {
        log.error("调用接口 /resource2 失败，参数: ");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getRes3() {
        log.error("调用接口 /resource3 失败，参数");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getPublicRes() {
        log.error("调用接口 /api/publicResource 失败，参数：");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getResTest01(){
        log.error("调用接口 /test01 失败，参数:");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getResTest02(){
        log.error("调用接口 /test02 失败，参数：");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getResApp(){
        log.error("调用接口 /app 失败，参数：");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getResWeb(){
        log.error("调用接口 /web 失败，参数：");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getResProjects(){
        log.error("调用接口 /projects 失败，参数：");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }

    @Override
    public Object getResUserInfo(){
        log.error("调用接口 /userInfo 失败，参数：");
        throw new BusinessException(CommonErrorCode.UNKNOWN_ERROR, CommonErrorCode.UNKNOWN_ERROR.getMessage());
    }


}
